1 <?php include ( "../inc/connect.inc.php" ); ?>
2 <?php
3 ob_start();
4 session_start();

5 if
(!isset($_SESSION['admin_login'])) {
6     header(
"location: login.php");
7     $user =
"";
8 }

9 else
{
10     $user = $_SESSION[
'admin_login'];
11     $result = mysql_query(
"SELECT * FROM admin WHERE id='$user'");
12         $get_user_email = mysql_fetch_assoc($result);
13             $uname_db = $get_user_email[
'firstName'];
14 }

15 if
(isset($_REQUEST['keywords'])) {
16
17     $epid = mysql_real_escape_string($_REQUEST[
'keywords']);
18     
if($epid != "" && ctype_alnum($epid)){
19         
20     }
else {
21         header(
'location: index.php');
22     }
23 }
else {
24     header(
'location: index.php');
25 }
26
27 $search_value =
"";
28 $search_value = trim($_GET[
'keywords']);
29 ?>
30
31
32 <!doctype html>
33 <html>
34     <head>
35         <title>Welcome to ebuybd online shop</title>
36         <link rel=
"stylesheet" type="text/css" href="../css/style.css">
37     </head>
38     <body
class="home-welcome-text" style="background-image: url(../image/homebackgrndimg2.png);">
39         <div
class="homepageheader">
40             <div
class="signinButton loginButton">
41                 <div
class="uiloginbutton signinButton loginButton" style="margin-right: 40px;">
42                     <?php
43                         
if ($user!="") {
44                             echo
'<a style="text-decoration: none;color: #fff;" href="logout.php">LOG OUT</a>';
45                         }
46                      ?>
47                     
48                 </div>
49                 <div
class="uiloginbutton signinButton loginButton">
50                     <?php
51                         
if ($user!="") {
52                             echo
'<a style="text-decoration: none;color: #fff;" href="login.php">Hi '.$uname_db.'</a>';
53                         }
54                         
else {
55                             echo
'<a style="text-decoration: none;color: #fff;" href="login.php">LOG IN</a>';
56                         }
57                      ?>
58                 </div>
59             </div>
60             <div style=
"float: left; margin: 5px 0px 0px 23px;">
61                 <a href=
"index.php">
62                     <img style=
" height: 75px; width: 130px;" src="../image/ebuybdlogo.png">
63                 </a>
64             </div>
65             <div
class="">
66             <div id=
"srcheader">
67                 <form id=
"newsearch" method="get" action="search.php">
68                         <?php
69                             echo
'<input type="text" class="srctextinput" name="keywords" size="21" maxlength="120" placeholder="Search Here..." value="'.$search_value.'"><input type="submit" value="search" class="srcbutton" >';
70                          ?>
71                 </form>
72             <div
class="srcclear"></div>
73             </div>
74         </div>
75         </div>
76         <div
class="categolis">
77             <table>
78                 <tr>
79                     <th>
80                         <a href=
"index.php" style="text-decoration: none;color: #fff;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Home</a>
81                     </th>
82                     <th><a href=
"addproduct.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Add Product</a></th>
83                     <th><a href=
"newadmin.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">New Admin</a></th>
84                     <th><a href=
"allproducts.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">All Products</a></th>
85                     <th><a href=
"orders.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Orders</a></th>
86                 </tr>
87             </table>
88         </div>
89         <div>
90             <table
class="rightsidemenu">
91                 <tr style=
"font-weight: bold;" colspan="10" bgcolor="#4DB849">
92                     <th>Id</th>
93                     <th>P Name</th>
94                     <th>Description</th>
95                     <th>Price</th>
96                     <th>Available</th>
97                     <th>Category</th>
98                     <th>Type</th>
99                     <th>Item</th>
100                     <th>P Code</th>
101                     <th>Edit</th>
102                 </tr>
103                 <tr>
104                     <?php include (
"../inc/connect.inc.php");
105                     $search_value = trim($_GET[
'keywords']);
106                     $query =
"SELECT * FROM products WHERE pName like '%$search_value%' ORDER BY id DESC";
107                     $run = mysql_query($query);
108                     
if ( $total = mysql_num_rows($run)) {
109                     
while ($row=mysql_fetch_assoc($run)) {
110                         $id = $row[
'id'];
111                         $pName = substr($row[
'pName'], 0,50);
112                         $descri = $row[
'description'];
113                         $price = $row[
'price'];
114                         $available = $row[
'available'];
115                         $category = $row[
'category'];
116                         $type = $row[
'type'];
117                         $item = $row[
'item'];
118                         $pCode = $row[
'pCode'];
119                         $picture = $row[
'picture'];
120                     
121                      ?>
122                     <th><?php echo $id; ?></th>
123                     <th><?php echo $pName; ?></th>
124                     <th><?php echo $descri; ?></th>
125                     <th><?php echo $price; ?></th>
126                     <th><?php echo $available; ?></th>
127                     <th><?php echo $category; ?></th>
128                     <th><?php echo $type; ?></th>
129                     <th><?php echo $item; ?></th>
130                     <th><?php echo $pCode; ?></th>
131                     <th><?php echo
'<div class="home-prodlist-img"><a href="editproduct.php?epid='.$id.'">
132                                     <img src=
"../image/product/'.$item.'/'.$picture.'" class="home-prodlist-imgi" style="height: 75px; width: 75px;">
133                                     </a>
134                                 </div>
' ?></th>
135                 </tr>
136                 <?php }
137                     }
138                  ?>
139             </table>
140         </div>
141     </body>
142 </html>


Gõ tìm kiếm nhanh...